home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pagede1a / main1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-31  |  22.1 KB  |  682 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    BorderStyle     =   1  'Fixed Single
  6.    ClientHeight    =   10965
  7.    ClientLeft      =   15
  8.    ClientTop       =   15
  9.    ClientWidth     =   9210
  10.    ControlBox      =   0   'False
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MDIChild        =   -1  'True
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   10965
  16.    ScaleWidth      =   9210
  17.    Begin VB.PictureBox picHandle 
  18.       Appearance      =   0  'Flat
  19.       BackColor       =   &H8000000D&
  20.       BorderStyle     =   0  'None
  21.       BeginProperty Font 
  22.          Name            =   "MS Sans Serif"
  23.          Size            =   8.25
  24.          Charset         =   0
  25.          Weight          =   700
  26.          Underline       =   0   'False
  27.          Italic          =   0   'False
  28.          Strikethrough   =   0   'False
  29.       EndProperty
  30.       ForeColor       =   &H80000008&
  31.       Height          =   375
  32.       Index           =   0
  33.       Left            =   2520
  34.       ScaleHeight     =   375
  35.       ScaleWidth      =   375
  36.       TabIndex        =   1
  37.       Top             =   2640
  38.       Visible         =   0   'False
  39.       Width           =   375
  40.    End
  41.    Begin VB.Label Label3 
  42.       Alignment       =   2  'Center
  43.       BorderStyle     =   1  'Fixed Single
  44.       Caption         =   "  Html code  "
  45.       Height          =   255
  46.       Index           =   0
  47.       Left            =   3120
  48.       TabIndex        =   3
  49.       ToolTipText     =   "Html code"
  50.       Top             =   1440
  51.       Visible         =   0   'False
  52.       Width           =   960
  53.    End
  54.    Begin VB.Label Label2 
  55.       BackColor       =   &H00000000&
  56.       Height          =   30
  57.       Index           =   0
  58.       Left            =   1800
  59.       TabIndex        =   2
  60.       ToolTipText     =   "Line"
  61.       Top             =   480
  62.       Visible         =   0   'False
  63.       Width           =   3015
  64.    End
  65.    Begin VB.Shape Shape1 
  66.       Height          =   975
  67.       Index           =   0
  68.       Left            =   1560
  69.       Top             =   960
  70.       Visible         =   0   'False
  71.       Width           =   1335
  72.    End
  73.    Begin VB.Image Image1 
  74.       Appearance      =   0  'Flat
  75.       BorderStyle     =   1  'Fixed Single
  76.       Height          =   1455
  77.       Index           =   0
  78.       Left            =   360
  79.       Top             =   1560
  80.       Visible         =   0   'False
  81.       Width           =   1335
  82.    End
  83.    Begin VB.Label Label1 
  84.       Alignment       =   2  'Center
  85.       Appearance      =   0  'Flat
  86.       BackColor       =   &H80000005&
  87.       BackStyle       =   0  'Transparent
  88.       BorderStyle     =   1  'Fixed Single
  89.       Caption         =   "Add Text"
  90.       BeginProperty Font 
  91.          Name            =   "Arial"
  92.          Size            =   12
  93.          Charset         =   0
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       ForeColor       =   &H80000008&
  100.       Height          =   255
  101.       Index           =   0
  102.       Left            =   240
  103.       TabIndex        =   0
  104.       ToolTipText     =   "Text"
  105.       Top             =   240
  106.       Visible         =   0   'False
  107.       Width           =   1335
  108.    End
  109. Attribute VB_Name = "Form1"
  110. Attribute VB_GlobalNameSpace = False
  111. Attribute VB_Creatable = False
  112. Attribute VB_PredeclaredId = True
  113. Attribute VB_Exposed = False
  114. Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
  115. Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
  116. Private Declare Function ReleaseCapture Lib "user32" () As Long
  117. Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  118. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  119. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  120. Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
  121. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  122. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  123. Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
  124. Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
  125. Private Declare Function SetROP2 Lib "gdi32" (ByVal hdc As Long, ByVal nDrawMode As Long) As Long
  126. Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
  127. Private Const NULL_BRUSH = 5
  128. Private Const PS_SOLID = 0
  129. Private Const R2_NOT = 6
  130. Enum ControlState
  131.     StateNothing = 0
  132.     StateDragging
  133.     StateSizing
  134. End Enum
  135. Private m_CurrCtl As Control
  136. Private m_DragState As ControlState
  137. Private m_DragHandle As Integer
  138. Private m_DragRect As New CRect
  139. Private m_DragPoint As POINTAPI
  140. Private Type POINTAPI
  141.     X As Long
  142.     Y As Long
  143. End Type
  144. Private Type RECT
  145.     Left As Long
  146.     Top As Long
  147.     Right As Long
  148.     Bottom As Long
  149. End Type
  150. Sub zoomup(vle As Integer)
  151. On Error Resume Next
  152. Dim i As Integer
  153. Form1.Width = Form1.Width * vle
  154. Form1.Height = Form1.Height * vle
  155. Form1.ShowHandles False
  156. For i = 0 To Form1.Controls.Count - 1
  157. Form1.Controls(i).Left = Form1.Controls(i).Left * vle
  158. Form1.Controls(i).Top = Form1.Controls(i).Top * vle
  159. Form1.Controls(i).Width = Form1.Controls(i).Width * vle
  160. Form1.Controls(i).Height = Form1.Controls(i).Height * vle
  161. Form1.Controls(i).FontSize = Form1.Controls(i).FontSize * vle
  162. Next i
  163. zoo = zoo + 1
  164. End Sub
  165. Sub zoomdown(vle As Integer)
  166. On Error Resume Next
  167. Dim i As Integer
  168. Form1.Width = Form1.Width / vle
  169. Form1.Height = Form1.Height / vle
  170. Form1.ShowHandles False
  171. For i = 0 To Form1.Controls.Count - 1
  172. Form1.Controls(i).Left = Form1.Controls(i).Left / vle
  173. Form1.Controls(i).Top = Form1.Controls(i).Top / vle
  174. Form1.Controls(i).Width = Form1.Controls(i).Width / vle
  175. Form1.Controls(i).Height = Form1.Controls(i).Height / vle
  176. Form1.Controls(i).FontSize = Form1.Controls(i).FontSize / vle
  177. Next i
  178. zoo = zoo - 1
  179. End Sub
  180. Sub ShowHandles(Optional bShowHandles As Boolean = True)
  181.     Dim i As Integer
  182.     Dim xFudge As Long, yFudge As Long
  183.     Dim nWidth As Long, nHeight As Long
  184.     If bShowHandles And Not m_CurrCtl Is Nothing Then
  185.         With m_DragRect
  186.            
  187.             nWidth = (picHandle(0).Width \ 2)
  188.             nHeight = (picHandle(0).Height \ 2)
  189.             xFudge = (0.5 * Screen.TwipsPerPixelX)
  190.             yFudge = (0.5 * Screen.TwipsPerPixelY)
  191.            
  192.             picHandle(0).Move (.Left - nWidth) + xFudge, (.Top - nHeight) + yFudge
  193.             
  194.             picHandle(4).Move (.Left + .Width) - nWidth - xFudge, .Top + .Height - nHeight - yFudge
  195.           
  196.             picHandle(1).Move .Left + (.Width / 2) - nWidth, .Top - nHeight + yFudge
  197.            
  198.             picHandle(5).Move .Left + (.Width / 2) - nWidth, .Top + .Height - nHeight - yFudge
  199.           
  200.             picHandle(2).Move .Left + .Width - nWidth - xFudge, .Top - nHeight + yFudge
  201.          
  202.             picHandle(6).Move .Left - nWidth + xFudge, .Top + .Height - nHeight - yFudge
  203.          
  204.             picHandle(3).Move .Left + .Width - nWidth - xFudge, .Top + (.Height / 2) - nHeight
  205.             
  206.             picHandle(7).Move .Left - nWidth + xFudge, .Top + (.Height / 2) - nHeight
  207.         End With
  208.     End If
  209.     For i = 0 To 7
  210.         picHandle(i).Visible = bShowHandles
  211.     Next i
  212. End Sub
  213. Private Sub DrawDragRect()
  214.     Dim hPen As Long, hOldPen As Long
  215.     Dim hBrush As Long, hOldBrush As Long
  216.     Dim hScreenDC As Long, nDrawMode As Long
  217.     hScreenDC = GetDC(0)
  218.     hPen = CreatePen(PS_SOLID, 2, 0)
  219.     hOldPen = SelectObject(hScreenDC, hPen)
  220.     hBrush = GetStockObject(NULL_BRUSH)
  221.     hOldBrush = SelectObject(hScreenDC, hBrush)
  222.     nDrawMode = SetROP2(hScreenDC, R2_NOT)
  223.     Rectangle hScreenDC, m_DragRect.Left, m_DragRect.Top, _
  224.         m_DragRect.Right, m_DragRect.Bottom
  225.     SetROP2 hScreenDC, nDrawMode
  226.     SelectObject hScreenDC, hOldBrush
  227.     SelectObject hScreenDC, hOldPen
  228.     ReleaseDC 0, hScreenDC
  229.     DeleteObject hPen
  230. End Sub
  231. Private Sub DragBegin(ctl As Control)
  232.     Dim rc As RECT
  233.     ShowHandles False
  234.     Set m_CurrCtl = ctl
  235.     GetCursorPos m_DragPoint
  236.     m_DragRect.SetRectToCtrl m_CurrCtl
  237.     m_DragRect.TwipsToScreen m_CurrCtl
  238.     m_DragPoint.X = m_DragPoint.X - m_DragRect.Left
  239.     m_DragPoint.Y = m_DragPoint.Y - m_DragRect.Top
  240.     Refresh
  241.     DrawDragRect
  242.     m_DragState = StateDragging
  243.     ReleaseCapture
  244.     SetCapture hwnd
  245.     GetWindowRect hwnd, rc
  246.     ClipCursor rc
  247. End Sub
  248.  Sub DragEnd()
  249.     Set m_CurrCtl = Nothing
  250.     ShowHandles False
  251.     m_DragState = StateNothing
  252. End Sub
  253. Private Sub DragInit()
  254.     Dim i As Integer, xHandle As Single, yHandle As Single
  255.     xHandle = 5 * Screen.TwipsPerPixelX
  256.     yHandle = 5 * Screen.TwipsPerPixelY
  257.     For i = 0 To 7
  258.         If i <> 0 Then
  259.             Load picHandle(i)
  260.         End If
  261.         picHandle(i).Width = xHandle
  262.         picHandle(i).Height = yHandle
  263.         picHandle(i).ZOrder
  264.     Next i
  265.     picHandle(0).MousePointer = vbSizeNWSE
  266.     picHandle(1).MousePointer = vbSizeNS
  267.     picHandle(2).MousePointer = vbSizeNESW
  268.     picHandle(3).MousePointer = vbSizeWE
  269.     picHandle(4).MousePointer = vbSizeNWSE
  270.     picHandle(5).MousePointer = vbSizeNS
  271.     picHandle(6).MousePointer = vbSizeNESW
  272.     picHandle(7).MousePointer = vbSizeWE
  273.     Set m_CurrCtl = Nothing
  274. End Sub
  275. Private Sub BtnGraphic1_Click()
  276. End Sub
  277. Private Sub doc_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  278.   Dim i As Integer
  279.     If Button = vbLeftButton And m_bDesignMode Then
  280.       
  281.         For i = 0 To (Controls.Count - 1)
  282.            
  283.             If Not TypeOf Controls(i) Is Menu And Controls(i).Visible Then
  284.                 m_DragRect.SetRectToCtrl Controls(i)
  285.                 If m_DragRect.PtInRect(X, Y) Then
  286.                     DragBegin Controls(i)
  287.                     Exit Sub
  288.                 End If
  289.             End If
  290.         Next i
  291.         Set m_CurrCtl = Nothing
  292.         ShowHandles False
  293.     End If
  294. End Sub
  295. Private Sub doc_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  296. Dim nWidth As Single, nHeight As Single
  297.     Dim pt As POINTAPI
  298.     If m_DragState = StateDragging Then
  299.         nWidth = m_DragRect.Right - m_DragRect.Left
  300.         nHeight = m_DragRect.Bottom - m_DragRect.Top
  301.        
  302.         GetCursorPos pt
  303.         DrawDragRect
  304.         m_DragRect.Left = pt.X - m_DragPoint.X
  305.         m_DragRect.Top = pt.Y - m_DragPoint.Y
  306.         m_DragRect.Right = m_DragRect.Left + nWidth
  307.         m_DragRect.Bottom = m_DragRect.Top + nHeight
  308.         DrawDragRect
  309.     ElseIf m_DragState = StateSizing Then
  310.         GetCursorPos pt
  311.         DrawDragRect
  312.         Select Case m_DragHandle
  313.             Case 0
  314.                 m_DragRect.Left = pt.X
  315.                 m_DragRect.Top = pt.Y
  316.             Case 1
  317.                 m_DragRect.Top = pt.Y
  318.             Case 2
  319.                 m_DragRect.Right = pt.X
  320.                 m_DragRect.Top = pt.Y
  321.             Case 3
  322.                 m_DragRect.Right = pt.X
  323.             Case 4
  324.                 m_DragRect.Right = pt.X
  325.                 m_DragRect.Bottom = pt.Y
  326.             Case 5
  327.                 m_DragRect.Bottom = pt.Y
  328.             Case 6
  329.                 m_DragRect.Left = pt.X
  330.                 m_DragRect.Bottom = pt.Y
  331.             Case 7
  332.                 m_DragRect.Left = pt.X
  333.         End Select
  334.         DrawDragRect
  335.     End If
  336. End Sub
  337. Private Sub doc_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  338. If Button = vbLeftButton Then
  339.         If m_DragState = StateDragging Or m_DragState = StateSizing Then
  340.            
  341.             DrawDragRect
  342.             'Move control to new location
  343.             m_DragRect.ScreenToTwips m_CurrCtl
  344.             m_DragRect.SetCtrlToRect m_CurrCtl
  345.             'Restore sizing handles
  346.             ShowHandles True
  347.             'Free mouse movement
  348.             ClipCursor ByVal 0&
  349.             'Release mouse capture
  350.             ReleaseCapture
  351.             'Reset drag state
  352.             m_DragState = StateNothing
  353.         End If
  354.     End If
  355. End Sub
  356. Private Sub doc_Resize()
  357. If doc.Height > MDI.Height Then
  358. VScroll1.Max = (doc.Height - MDI.Height)
  359. End If
  360. End Sub
  361. Private Sub Form_Load()
  362. On Error Resume Next
  363. dirty = False
  364. bgclr = vbWhite
  365. vclr = vbRed
  366. tclr = vbBlack
  367. DragInit
  368. runtime = False
  369. Kill App.Path & "\tmp2.tmp"
  370. FileCopy App.Path & "\tmp.tmp", App.Path & "\tmp2.tmp"
  371. Form2.Show
  372. End Sub
  373. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  374. On Error Resume Next
  375.  Dim i As Integer
  376. If runtime = True Then
  377. ShowHandles False
  378. End If
  379.     If Button = vbLeftButton And runtime = False Then
  380.          dirty = True
  381.           Form7.Visible = False
  382.         If addctrl = "line" Then
  383.         MDI.lneput X, Y
  384.         addctrl = "mouse"
  385.         End If
  386.           If addctrl = "tag" Then
  387.         MDI.hmlput X, Y
  388.         addctrl = "mouse"
  389.         End If
  390.           If addctrl = "image" Then
  391.         MDI.imgput X, Y
  392.         addctrl = "mouse"
  393.         End If
  394.           If addctrl = "text" Then
  395.         MDI.txtput X, Y
  396.         addctrl = "mouse"
  397.         End If
  398.         'Hit test over light-weight (non-windowed) controls
  399.         For i = 0 To (Controls.Count - 1)
  400.              
  401.           
  402.              
  403.      
  404.             If Controls(i).Visible = True Then
  405.                  If Not TypeOf Controls(i) Is Shape Then
  406.                
  407.                   End If
  408.                 m_DragRect.SetRectToCtrl Controls(i)
  409.                 If m_DragRect.PtInRect(X, Y) Then
  410.                     DragBegin Controls(i)
  411.                     If TypeOf Controls(i) Is Shape Then
  412.                 
  413.                     Else
  414.                     
  415.                     End If
  416.                     Exit Sub
  417.                     End If
  418.            
  419.             End If
  420.      
  421.         Next i
  422.         'No control is active
  423.         Set m_CurrCtl = Nothing
  424.         'Hide sizing handles
  425.         ShowHandles False
  426.     End If
  427. End Sub
  428. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  429. Dim nWidth As Single, nHeight As Single
  430. If Button = vbLeftButton Then
  431.     Dim pt As POINTAPI
  432.     If m_DragState = StateDragging Then
  433.          dirty = True
  434.         'Save dimensions before modifying rectangle
  435.         nWidth = m_DragRect.Right - m_DragRect.Left
  436.         nHeight = m_DragRect.Bottom - m_DragRect.Top
  437.         'Get current mouse position in screen coordinates
  438.         GetCursorPos pt
  439.         'Hide existing rectangle
  440.         DrawDragRect
  441.         'Update drag rectangle coordinates
  442.         m_DragRect.Left = pt.X - m_DragPoint.X
  443.         m_DragRect.Top = pt.Y - m_DragPoint.Y
  444.         m_DragRect.Right = m_DragRect.Left + nWidth
  445.         m_DragRect.Bottom = m_DragRect.Top + nHeight
  446.         'Draw new rectangle
  447.         DrawDragRect
  448.     ElseIf m_DragState = StateSizing Then
  449.         'Get current mouse position in screen coordinates
  450.         GetCursorPos pt
  451.         'Hide existing rectangle
  452.         DrawDragRect
  453.         'Action depends on handle being dragged
  454.         Select Case m_DragHandle
  455.             Case 0
  456.                 m_DragRect.Left = pt.X
  457.                 m_DragRect.Top = pt.Y
  458.             Case 1
  459.                 m_DragRect.Top = pt.Y
  460.             Case 2
  461.                 m_DragRect.Right = pt.X
  462.                 m_DragRect.Top = pt.Y
  463.             Case 3
  464.                 m_DragRect.Right = pt.X
  465.             Case 4
  466.                 m_DragRect.Right = pt.X
  467.                 m_DragRect.Bottom = pt.Y
  468.             Case 5
  469.                 m_DragRect.Bottom = pt.Y
  470.             Case 6
  471.                 m_DragRect.Left = pt.X
  472.                 m_DragRect.Bottom = pt.Y
  473.             Case 7
  474.                 m_DragRect.Left = pt.X
  475.         End Select
  476.         'Draw new rectangle
  477.         DrawDragRect
  478.     End If
  479.     End If
  480. End Sub
  481. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  482. If Button = vbLeftButton Then
  483.  dirty = True
  484.         If m_DragState = StateDragging Or m_DragState = StateSizing Then
  485.             'Hide drag rectangle
  486.             DrawDragRect
  487.             'Move control to new location
  488.             m_DragRect.ScreenToTwips m_CurrCtl
  489.             m_DragRect.SetCtrlToRect m_CurrCtl
  490.             'Restore sizing handles
  491.             ShowHandles True
  492.             'Free mouse movement
  493.             ClipCursor ByVal 0&
  494.             'Release mouse capture
  495.             ReleaseCapture
  496.             'Reset drag state
  497.             m_DragState = StateNothing
  498.         End If
  499.       
  500.     End If
  501. End Sub
  502. Private Sub Form_Paint()
  503. If MDI.Picture11.Tag <> "" Then
  504. Dim X As Single
  505. Dim Y As Single
  506. Y = 0
  507. X = 0
  508. Me.PaintPicture MDI.Picture11.Picture, 0, 0, MDI.Picture11.Width, MDI.Picture11.Height, 0, 0, MDI.Picture11.Width, MDI.Picture11.Height
  509. X = X + MDI.Picture11.Width
  510. Me.PaintPicture MDI.Picture11.Picture, X, Y, MDI.Picture11.Width, MDI.Picture11.Height, 0, 0, MDI.Picture11.Width, MDI.Picture11.Height
  511. If X > Me.Width Then
  512. X = -MDI.Picture11.Width
  513. Y = Y + MDI.Picture11.Height
  514. End If
  515. Loop Until Y > Me.ScaleHeight
  516. End If
  517. End Sub
  518. Private Sub Form_Resize()
  519. On Error Resume Next
  520. Form1.Left = ((MDI.Width) - Form1.Width - MDI.Toolbar2.Width) / 2
  521. Form1.Top = (MDI.Height - Form1.Height - MDI.Picture13.Height) / 2
  522. End Sub
  523. Private Sub Form_Unload(Cancel As Integer)
  524. Unload Form7
  525. End Sub
  526. Private Sub Image1_Click(Index As Integer)
  527. ccindexx = Index
  528. ctrltype = "image"
  529. End Sub
  530. Private Sub Image1_DblClick(Index As Integer)
  531. On Error Resume Next
  532. Dim str1 As String
  533. Dim str2 As String
  534. indexctrl = Index
  535. Form5.Text1.Text = Image1(indexctrl).ToolTipText
  536. Form5.Text2.Text = Image1(indexctrl).Tag
  537. Form5.Tag = "image"
  538. Form5.Show vbModal
  539. End Sub
  540. Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  541. On Error Resume Next
  542. If Button = 2 Then
  543. Me.PopupMenu MDI.mnuedit
  544. End If
  545. ccindexx = Index
  546. ctrltype = "image"
  547. If runtime = False Then
  548. If Button = vbLeftButton Then
  549. DragBegin Image1(Index)
  550. Form7.Visible = False
  551. End If
  552.  End If
  553. End Sub
  554. Private Sub Label1_Click(Index As Integer)
  555. ccindexx = Index
  556. ctrltype = "text"
  557. End Sub
  558. Private Sub Label1_DblClick(Index As Integer)
  559. On Error Resume Next
  560. Dim str1 As String
  561. Dim str2 As String
  562. indexctrl = Index
  563. Form5.Text2.Text = Label1(indexctrl).Tag
  564. Form5.Tag = "label"
  565. Form5.Show vbModal
  566. End Sub
  567. Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  568. On Error Resume Next
  569. If Button = 2 Then
  570. Me.PopupMenu MDI.mnuedit
  571. End If
  572. ccindexx = Index
  573. ctrltype = "text"
  574. If Button = vbLeftButton And runtime = False Then
  575. Form7.Left = 0
  576. Form7.Top = 0
  577. Form7.Show
  578. MDI.Tag = "label"
  579. changes = True
  580. Form7.Text1.Tag = Index
  581. Form7.Text1.SetFocus
  582. Form7.Text1.Text = Label1(Index).Caption
  583. Form7.Combo2.Text = Label1(Index).FontName
  584. Form7.Combo3.Text = Label1(Index).FontSize
  585. Dim i As Integer
  586. For i = 0 To 2
  587. If i = Label1(Index).Alignment Then Form7.Option1(i).Value = Label1(Index).Alignment
  588. Next i
  589. If Label1(Index).FontBold = True Then
  590. Form7.Check1.Value = 1
  591. Form7.Check1.Value = 0
  592. End If
  593. If Label1(Index).FontItalic = True Then
  594. Form7.Check2.Value = 1
  595. Form7.Check2.Value = 0
  596. End If
  597. If Label1(Index).FontUnderline = True Then
  598. Form7.Check3.Value = 1
  599. Form7.Check3.Value = 0
  600. End If
  601. Form7.Picture4.BackColor = Label1(Index).ForeColor
  602. Form7.Picture5.BackColor = Label1(Index).BackColor
  603. Form7.Check4.Value = Label1(Index).BackStyle
  604. Form7.Text1.SelStart = 0
  605. Form7.Text1.SelLength = Len(Form7.Text1.Text)
  606. Form7.Text1.SetFocus
  607.  End If
  608.  If Button = vbLeftButton Then
  609. DragBegin Label1(Index)
  610. End If
  611. End Sub
  612. Private Sub Label2_Click(Index As Integer)
  613. ccindexx = Index
  614. ctrltype = "line"
  615. End Sub
  616. Private Sub Label2_DblClick(Index As Integer)
  617. On Error GoTo er
  618. MDI.CommonDialog1.ShowColor
  619. Label2(Index).BackColor = MDI.CommonDialog1.Color
  620. Exit Sub
  621. If Err.Number <> 32755 Then
  622. MsgBox Err.Description
  623. End If
  624. End Sub
  625. Private Sub Label2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  626. On Error Resume Next
  627. If Button = 2 Then
  628. Me.PopupMenu MDI.mnuedit
  629. End If
  630. ccindexx = Index
  631. ctrltype = "line"
  632. If Button = vbLeftButton Then
  633. DragBegin Label2(Index)
  634. End If
  635. End Sub
  636. Private Sub Label3_DblClick(Index As Integer)
  637. On Error Resume Next
  638. Form6.Show vbModal
  639. ccindexx = Index
  640. End Sub
  641. Private Sub Label3_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  642. On Error Resume Next
  643. If Button = 2 Then
  644. Me.PopupMenu MDI.mnuedit
  645. End If
  646. ccindexx = Index
  647. ctrltype = "html"
  648. If Button = vbLeftButton Then
  649. DragBegin Label3(Index)
  650. End If
  651. End Sub
  652. Private Sub picHandle_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  653.  Dim i As Integer
  654.     Dim rc As RECT
  655.     'Handles should only be visible when a control is selected
  656.     Debug.Assert (Not m_CurrCtl Is Nothing)
  657.     'NOTE: m_DragPoint not used for sizing
  658.     'Save control position in screen coordinates
  659.     m_DragRect.SetRectToCtrl m_CurrCtl
  660.     m_DragRect.TwipsToScreen m_CurrCtl
  661.     'Track index handle
  662.     m_DragHandle = Index
  663.     'Hide sizing handles
  664.     ShowHandles False
  665.     'We need to force handles to hide themselves before drawing drag rectangle
  666.     Refresh
  667.     'Indicate sizing is under way
  668.     m_DragState = StateSizing
  669.     'Show sizing rectangle
  670.     DrawDragRect
  671.     'In order to detect mouse movement over any part of the form,
  672.     'we set the mouse capture to the form and will process mouse
  673.     'movement from the applicable form events
  674.     SetCapture hwnd
  675.     'Limit cursor movement within form
  676.     GetWindowRect hwnd, rc
  677.     ClipCursor rc
  678. End Sub
  679. Private Sub Script_Error()
  680. MsgBox Script.Error.Description & " at " & Script.Error.Text
  681. End Sub
  682.